'use strict';

const { Controller } = require('egg');

/**
 * config.default.js需配置
 * config.multipart = {
    mode: 'file',
    fileSize: '10mb',
  };
 */

class CakeController extends Controller {
  async upload() {
    const { ctx } = this;
    const file = ctx.request.files[0];

    // 自定义上传文件的逻辑，例如保存到服务器或数据库中
    ctx.body = {
      code: 0,
      message: 'File uploaded successfully!',
      result: file,
    };
  }
}

module.exports = CakeController;
